package io;

import java.io.*;
import java.nio.charset.StandardCharsets;

/**
 * 转换流
 * 测试读取文本数据
 */
public class ISRDemo {
    public static void main(String[] args) throws IOException {
        FileInputStream fis = new FileInputStream("ows.txt");
        InputStreamReader isr = new InputStreamReader(fis, StandardCharsets.UTF_8);

        /*
            int read()
            读取一个字符，将对应的char值存入返回的int值的“低16位”
            如果返回的int值为-1，表示读取到末尾
         */
        int d;
        while((d = isr.read()) != -1){
            System.out.print((char)d);
        }

        //System.out.println((char)d);
        isr.close();


    }
}
